import java.io.*;
import java.util.*;

public class TaskI extends Thread {
    public TaskI() {
        try {
            this.input = new BufferedReader(new FileReader("input.txt"));
            this.output = new PrintWriter("output.txt");
            this.setPriority(Thread.MAX_PRIORITY);
        } catch (Exception e) {
            System.exit(666);
        }
    }




    private void solve() throws Throwable {
        int testCount = nextInt();
        for (int test = 0; test < testCount; ++test) {
            double R = nextInt(), vPooh = nextInt(), vBee = nextInt(), omegaBee = Math.PI * nextInt() * 2;
            double ans = .0;
            double step = R / (vBee * ITERATIONS);
            for (int i = 0; i < ITERATIONS; ++i) {
                double current = i * step;
                ans += Math.hypot(-vBee * Math.cos(omegaBee * current) - omegaBee * (R - vBee * current) * Math.sin(omegaBee * current) + vPooh,
                        -vBee * Math.sin(omegaBee * current) + omegaBee *  (R - vBee * current) * Math.cos(omegaBee * current));
            }
            output.printf("%.10f\n", ans * step);
        }
    }


    public void run() {
        try {
            solve();
        } catch (Throwable e) {
            System.err.println(e.getMessage());
            e.printStackTrace();
            System.exit(666);
        } finally {
            output.flush();
            output.close();
        }
    }

    public static void main(String[] args) {
        new TaskI().start();
    }

    private int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }

    private long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }

    private double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }

    private String nextToken() throws IOException {
        while (tokens == null || !tokens.hasMoreTokens()) {
            tokens = new StringTokenizer(input.readLine());
        }
        return tokens.nextToken();
    }

    private static final int ITERATIONS = 10000;
    private BufferedReader input;
    private PrintWriter output;
    private StringTokenizer tokens = null;
}